﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Longbow.Security.Cryptography;
using Bootstrap.Security;
using PetaPoco;
using Longbow.Web.Mvc;
using System.Threading;

namespace Bootstrap.DataAccess.Model
{
    /// <summary>
    /// 活动呼叫
    /// </summary>

    public class ActiveCalls
    {
        public string uuid { get; set; } //呼叫参考号
        public string cid_num { get; set; } //主叫号
        public string callee_num { get; set; }//被叫号
        public string dest { get; set; }//分机号
        public string state { get; set; }//当前状态
        public string CallDirection { get; set; }//方向
        public string created { get; set; }//开始时间
        public string TIME { get; set; }//持续时间
        public string InCall { get; set; }//最大并发呼入数
        public string OutCall { get; set; }//最大并发呼出数



        //活动呼叫sql
        private string _sql = "	select * from ActiveCalls";
        //private static readonly object Calls = new object();
        /// <summary>
        /// 查询活动呼叫
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public virtual Page<ActiveCalls> RetrievePages(PaginationOption po)
        {
            var sql = new Sql(_sql);
            sql.OrderBy($"{po.Sort} {po.Order}");

            return DbManager.Create().Page<ActiveCalls>(po.PageIndex, 20000, sql);
        }
    }
}
